/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page1={
    create:function () {
        var page={};

        var tw_t0,tw_t1,tw_gp0,tw_gp1;
        page.ui=new PIXI.DisplayObjectContainer();

        var bg=new PIXI.Sprite(resource['assets/images/p1_bg.png'].texture);
        page.ui.addChild(bg);

        var gp=new PIXI.Graphics();
        gp.beginFill(0x0);
        gp.drawRect(-453/2,-380/2,453,380);
        // gp.anchor.set(0.5);
        gp.x=370;
        gp.y=764;
        gp.scale.x=1;
        gp.scale.y=1;
        gp.alpha=0;
        page.ui.addChild(gp);
        // TweenMax.to(gp,1.5,{alpha:0.6,ease:Cubic.easeInOut,yoyo:true,repeat:-1});

        var t0=new PIXI.Sprite(resource['assets/images/p1_t0.png'].texture);
        t0.x=370;
        t0.y=732;
        t0.alpha=0;
        t0.anchor.set(0.5);
        page.ui.addChild(t0);
        // console.log(t0.texture.width);

        var t1=new PIXI.Sprite(resource['assets/images/p0_t1.png'].texture);
        t1.x=370;
        t1.y=807;
        t1.alpha=0;
        t1.anchor.set(0.5);
        page.ui.addChild(t1);

        var tip= new PIXI.Sprite(resource['assets/images/tip.png'].texture);
        tip.x = 370;
        tip.y = 1105;
        tip.alpha = 1;
        tip.anchor.set(0.5);
        page.ui.addChild(tip);
        TweenMax.to(tip,0.7,{y:1105-30,ease:Cubic.easeInOut,yoyo:true,repeat:-1});

        // var arr_texture=[];
        // for(var i=1;i<25;i++)
        // {
        //     if(i<10)
        //     {
        //         var texture = resource['assets/images/click000'+i.toString()+'.png'].texture;
        //     }
        //     else
        //     {
        //         var texture = resource['assets/images/click00'+i.toString()+'.png'].texture;
        //     }
        //     arr_texture.push(texture);
        //
        // }
        // var sp_click=new PIXI.extras.AnimatedSprite(arr_texture);
        // sp_click.anchor.set(0.5);
        // sp_click.x=380;
        // sp_click.y=900;
        // sp_click.animationSpeed=0.4;
        // sp_click.alpha=0;
        // sp_click.gotoAndPlay(1);
        // // page.ui.addChild(sp_click);
        // tw_click=new TWEEN.Tween({alpha:0,scale:0})
        //     .to({alpha:1,scale:1},1000)
        //     .onUpdate(function () {
        //         sp_click.scale.x=this.scale;
        //         sp_click.scale.y=this.scale;
        //         sp_click.alpha=this.alpha;
        //     })
        //     .delay(300)
        //     .easing(TWEEN.Easing.Back.Out);






        page.In=function () {
            TweenMax.killTweensOf(t0);
            TweenMax.killTweensOf(t1);
            TweenMax.killTweensOf(t1);

            t0.x=370+100;
            t1.x=370-100;
            tw_t0=TweenMax.to(t0,1,{delay:0.0,x:370,alpha:1,ease:Cubic.easeInOut});
            tw_t1=TweenMax.to(t1,1,{delay:0.0,x:370,alpha:1,ease:Cubic.easeInOut});

            gp.alpha=0;
            tw_gp0=TweenMax.to(gp,1,{alpha:0.5,ease:Cubic.easeInOut});

        }

        page.Out=function () {
            tw_whole=TweenMax.to(page.ui,0.6,{alpha:0,onComplete:function () {
                t0.alpha=0;
                t1.alpha=0;
                gp.alpha=0;
                page.ui.alpha=1;
            }})
        }

        return page;
    }
}